//
//  TabBarController.swift
//  firstProject
//
//  Created by 张彦辉 on 2017/3/9.
//  Copyright © 2017年 张彦辉. All rights reserved.
//

import UIKit

class TabBarController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.title = "测试1"
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}

// MARK: -UITabBarDelegate
extension TabBarController{
    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
        let tag = item.tag
        var titleDesc = ""
        if tag == 1 {
            titleDesc = "测试1"
        }else if tag == 2 {
            titleDesc = "功能演示"
        }else if tag == 3 {
            titleDesc = "测试\(item.tag)"
        }
        self.title = titleDesc
    }
}


